import React, { Component } from 'react';
import { Drawer } from 'antd';
import { connect } from 'umi';

class Warning_message extends Component {
  onClose() {
    const { dispatch } = this.props;
    dispatch &&
      dispatch({
        type: 'warningManage/changeVisible',
      });
  }

  render() {
    const { visiable, warningData } = this.props;
    return (
      <Drawer
        headerStyle={{ background: '#263B5B' }}
        bodyStyle={{ background: '#0D1C2F' }}
        title={[<div style={{ color: 'white' }}>调度方案详情</div>]}
        open={visiable}
        closeIcon={[<div style={{ color: 'white' }}>×</div>]}
        onClose={() => {
          this.onClose();
        }}
      >
        <p style={{ color: 'red' }}>{warningData[0]}</p>
        <p style={{ color: 'orange' }}>{warningData[1]}</p>
        <p style={{ color: 'white' }}>{warningData[2]}</p>
      </Drawer>
    );
  }
}

export default connect(({ warningManage }) => ({
  visiable: warningManage.visiable,
  warningData: warningManage.warningData,
}))(Warning_message);
